<?php
/*
 * Created on Jan 24, 2010
 * Shopping Cart System
 * Owner: Phu Ha
 * To change the template for this generated file go to
 * Window - Preferences - PHPeclipse - PHP - Code Templates
 */



class MVCAutoLoadClass {	
	public static function MVCAutoLoad($class_name) {
		if (strpos($class_name, 'Doctrine_') !== false) {
			return false;
		}
		
		if (class_exists($class_name, false) || interface_exists($class_name, false)) {
            return false;
        }
		
		$logger = Logger::getLogger(LOGGER_MVC);	
		
		$filename = $class_name . '.php';		
		$file = GLOBAL_ROOT_CLASSES . $filename;
		$logger->info('Method MVCAutoLoad: Included class: ' . $file . '<br/>');
		$logger->debug('Method MVCAutoLoad: Included class exists? ' . file_exists($file) . '<br/>');
		
		//should improve this if else statement to throw out the exceptional and handling it outside
		//'cause of security on server, we cannot use this function
		if (file_exists($file) == false) {
			$logger->warn('Method MVCAutoLoad: Included class doesn\'t exist: ' . $file . '<br/>');
			return false;
		}
		
		require_once($file);
		$logger->info('Method MVCAutoLoad: Included class loaded: ' . $file . '<br/>');
	}
}




 
 
 
?>
